-
"Before being intelligent, one must not be stupid. A character that can stay 'grounded' in the environment can convey much more intelligence than a complex character that does stupid things."
-
"Results in behaviors that appear more intelligent and natural."
-
"Utility AI is extremely flexible. Instead of relying on rigid transitions between states or predefined behavior hierarchies, the agent can adapt dynamically to a wide range of situations."
-
"It is relatively easy to add new actions or adjust utility functions for more complex behaviors without having to redesign the whole system."
-
Disadvantages:
-
"Loss of some designer control".
-
"Can be hard to conceptualize".
-
Games that use it
-
The Sims.
-
Into The Breach.
-
Half-Life 2.
-
Spore.
-
Warframe.
-
Zoo Tycoon.
"Types" of Utility AI
-
"Absolute Utility"
-
Ranks / divides into categories.
-
-
"Relative Utility".
-
Calculates how "appropriate" something is.
-
Structure
-
'Consideration':
-
Is a number representing a subset of game state which, from the perspective of the algorithm, is worth being considered during score calculation.
-
-
'Curve':
-
Is a function that converts one value into another. It usually takes the form of an analytical curve.
-
-
'Evaluator':
-
Is responsible for processing 'considerations' and returning the final score assigned to the evaluated behavior.
-
-
'Selector':
-
Is responsible for selecting the most suitable behavior based on scores received from evaluators.
-
"Aggregation Methods"
-
"Methods used to evaluate multiple considerations and obtain the final score".
-
Mult
-
Sum
-
Average
-
Max
-
Min
"Weight"
-
On the obtained score after aggregating the considerations.
-
Used in:
-
'Applying Weight and mathematical equations in Utility AI'.
-
-
-
On the individual score of each consideration, before aggregation.
-
No use of weight.
-
Used in:
-
Implementing Utility AI in Unity.
-
-
"Tags"
-
"The entity is this kind of thing".
-
"This event happened".
-
"This state is active".
-
Race
-
Faction
-
History
-
Also:
-
Attributes.
-
Effects.
-
Interruptions
-
"How to solve the problem where one action switches to another due to runtime variations while the first action is being executed?"
-
Make a bool to store whether the action can or cannot be interrupted.
-
Make a float of "persistence", where the current action is assigned a modifier so that the new action must have a substantially higher score for the action to be changed.
-
I found this suggestion quite useful.
-
-
Explanations
-
Applying Weight and mathematical equations in Utility AI .
-
Great video. It shows in practice how the analysis of considerations is done after their normalization.
-
Presentation from 2015.
-
My notes :
-
DSEs (Decision Score Evaluators).
-
Have internal considerations to obtain a final score.
-
Carry an action with them.
-
-
Skill Set and a Decision Maker:
-
.
-
The only difference between a Skill Set and a Decision Maker is that a Skill Set uses an "export" parameter corresponding to the animation / attack action. This is done because the DSEs used for Skill Sets are not specific to a single action and can be used across multiple characters.
-
All DSEs from Skill Sets and DSEs from Decision Makers are put in the same "bucket", that is, without making any distinction between "combat" and "out of combat".
-
-
Score evaluation:
-
The only thing that truly makes the entity not be "stupid" in combat (or vice versa), is that each DSE has an attached weight, so that Skill Set DSEs have weight 3.0, while Decision Maker DSEs can vary from weight 1.0 up to about 4.0~5.0.
-
.
-
-
Multiplication of Scores:
-
A compensation factor is used when multiplying scores to "make the multiplication make more sense".
-
The equation is not explained.
-
-
modification_factor = 1 - (1 / num_considerations) -
makeup_value = (1 - score) * modification_factor -
`final_score_consideration = score + (makeup_value * score)
-
-
Optimization:
-
Considering that all possible actions are placed in the same "bucket", that requires optimization.
-
.
-
The 'min' is used as an output parameter for the loop to optimize the calculation. If the 'finalScore' drops below 'min', cancel the loop and return the 'finalScore'; that is, the action will not happen anyway, so give up and exit the loop.
-
This does not make much sense to be used if you use 'pick random' (or derivates) among the best actions. It makes sense in their case because they use 'pick best'.
-
-
-
-
Circumstantial DSEs (via new Decision Maker):
-
Behavior injection is used based on the entity's context. For example, if the entity enters a tavern, tavern actions are injected as now part of the pool of possible actions; upon leaving the cave, those possibilities are removed.
-
This injection is done via a new Decision Maker, parallel to the entity's Decision Maker, called "Decision Maker Package".
-
-
Evaluations of a DSE's circumstances:
-
"Influence Maps" are discussed, which are used when there are multiple enemies in the world and you want to know, for example, "am I close to an enemy?". Two maps were made for each entity: an influence map of where it can move in 1 second; a map of where it can attack.
-
At first I thought it was something very specific, only for analytics, but it can be useful to help decision-making when facing multiple enemies, etc.
-
-
-
{~10:00}
-
Compensation factor for multiplication of scores.
-
-
{20:30}
-
Explanation of DSEs (Decision Score Evaluators).
-
-
{23:50}
-
Differences between a 'Skill Set' and a 'Decision Maker'.
-
-
{29:10 -> 30:50}
-
"Decision Maker Packages".
-
-
{30:55 -> 44:55}.
-
"Influence Maps".
-
-
{51:55}
-
Example of assembling an AI.
-
.
-
.
-
.
-
-
-
Applying mathematical models in Utility AI .
-
Presentation from 2012.
-
The first part of the talk is about using "Absolute Utility" and "Relative Utility", following certain rules:
-
Do not use weight <= 0, it can be "inappropriate".
-
Do not use 'very small weight', since that causes "Artificial Stupidity".
-
Those options can be chosen randomly and can be stupid.
-
-
Use "weighted random".
-
This can only be done if the bad options are eliminated.
-
Random but Reasonable.
-
-
-
The second part of the talk is about applying mathematical models to decision making:
-
.
-
-
The second part is better presented and a bit more relevant.
-
-
Modeling behaviors with mathematical functions .
-
Presentation from 2010.
-
It is a more introductory presentation about the concept, although it shows some of the math behind the considerations.
-
His newer presentations are better.
-
The questions at the end of the video are interesting.
-
-
-
The video is much longer than it should be because the code architecture part is done slowly. There is little theoretical content.
-
Technique used:
-
After the status is normalized, he applies a curve for each status obtaining a score for the 'consideration'. He then averages all the action's considerations to obtain the action's final score.
-
No 'weight' is applied.
-
-
{01:00:50}
-
The most relevant part of the video, where the concepts applied in the video are explained via drawings.
-
-
-
Utility AI in Into The Breach .
-
You can hardly say that this game implements Utility AI, since the AI is so simple that none of the potential complexity of Utility AI is really used.
-
Characters only 'advance' -> 'attack' -> repeat.
-
-
Usage:
-
An interesting system is made where each tile of the game receives a score based on its "usefulness", so tiles near buildings or enemies receive '+5' to the score, while tiles near enemies receive '-2' to the score. A tile on fire receives '-15' to the score.
-
The score is obtained via an evaluation of the 'amount of damage' that can be dealt by attacking from that tile.
-
-
Randomization is used for balance so that it does not always pick the best option and gives greater variability.
-
Recently attacked targets receive fewer points to avoid attacking the same target twice in a row.
-
There is no cooperation between enemies; they do not even know the other exists.
-
-
-
-
Presentation from 2019.
-
It is said that the use of randomization is always interesting; "do not make it deterministic, because that makes it less interesting".
-
Task scheduling is discussed.
-
It is possible to have multiple tasks at the same time, but with different priority levels.
-
-
Mentions using graphical apps to better visualize the curves.
-
The mathematical implementation of 'considerations' or 'evaluations' is not explained.
-
-
Utility AI in triple-A games .
-
It is just a 'documentary' video showing the use of Utility AI in triple-A games; absolutely nothing technical.
-
It is very introductory and concise.
-
-
Utility AI in The Sims and in Warframe .
-
Presentation from 2018.
-
The first part talks about things to paid attention during pathfinding and 'Influence Maps'.
-
The second part gives motivations about Utility AI and ends with a demo of Utility AI, using tags and stats.
-
Overall, not a very relevant implementation video. It is basically a documentary, but it is interesting.
-
-
-
It explains a bit about curves and how to combine curves.
-
"Each consideration should be plotted on a curve".
-
"Weights can be used to multiply the final score "
-
-
Working with 'fuzzy floats' while using Utility AI.-
The video is somewhat irrelevant compared to the other videos. It is introductory and does not help much.
-
It introduces some more technical things about implementing the system, but does not give necessary solutions to those problems. For example, it does not explain how to de-abstract floats into something more tangible and debuggable.
-
Needs-based AI
-
About .
-
Used in The Sims as well, supposedly.
-
Seems like a category of Utility AI.
-
Tools
-
Desmos .
-
GeoGebra .
-
Curvature App, for visualizing and creating curves for Utility AI.-
The program seems to use XML for data, which I don't like.
-
After downloading I did not find it very relevant.
Addons for Godot
-
-
MIT License.
-
The addon is inside a demo project.
-
The addon offers little utility, but at the same time it is simple and concise.
-
I would not use it anywhere, but it's okay and serves as a basis to better understand the idea of Utility AI.
-
JarkkoPar's Addon, with GDExtension.-
It is a very complex addon with many nodes.
-
The system has signal emission, cooldown system, etc.
-
The problem is that it is extremely generalized, so it implements Behavior Trees inside it, etc.
-
Although the addon has documentation on GitHub, it is not possible to clear particular doubts because the variables and nodes are not documented in Godot, and you cannot inspect the code.
-
All addon files are binary...
-
-
I did not like the addon because of this. Maybe reading the documentation gives interesting ideas, but I did not feel like using it.
-
-
-
Uses a strange structure with Resources and Classes, without any node definition.
-
The code is well organized and technical, but done in a very questionable way.
-
The addon itself offers almost no utility. Absolutely nothing special. Just the basics.
-
I did not like the addon.
-